package com.killer.enums;


public enum TaskStatus {

    // 待支付，待发货，待收货，已完成
    CREATE(1, "创建任务"),
    EXPORT(2,"导出中"),
    FINISH(3, "导出完成"),
    FAILED(4,"失败");
    private Integer key;
    private String desc;
    TaskStatus(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }
    public Integer getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

    public static TaskStatus getByKey(Integer key) {
        for (TaskStatus e : values()) {
            if (e.getKey().equals(key)) {
                return e;
            }
        }
        throw new RuntimeException("enum not exists.");
    }
}
